Chapter 8 - Handlers
Handlers are collections of statements that are executed in response to commands or error messages.This chapter describes
- subroutines, which are handlers for user-defined commands
- command handlers for system or application commands
- command handlers for script applications
- the scope of script variables and properties declared in handlers and elsewhere in scripts
Chapter Contents
- Using Subroutines
- Types of Subroutines
- Scope of Subroutine Calls in Tell Statements
- Checking the Classes of Subroutine Parameters
- Recursive Subroutines
- Saving and Loading Libraries of Subroutines
- Subroutine Definitions and Calls
- Subroutines With Labeled Parameters
- Examples of Subroutines With Labeled Parameters
- Subroutines With Positional Parameters
- Examples of Subroutines With Positional Parameters
- The Return Statement
- Command Handlers
- Command Handlers for Script Applications
- Run Handlers
- Open Handlers
- Handlers for Stay-Open Script Applications
- Idle Handlers
- Quit Handlers
- Interrupting a Script Application's Handlers
- Calling a Script Application
- Scope of Script Variables and Properties
- Scope of Properties and Variables Declared at the Top Level of a Script
- Scope of Properties and Variables Declared in a Script Object
- Scope of Variables Declared in a Handler